import collections
class Solution(object):
    def canArrange(self, arr, k):
        d = collections.defaultdict(int)
        for num in arr:
            d[num % k] += 1
        for key in d:
            if key == k - key or key == 0:
                if d[key] % 2:
                    return False
            else:
                if d[key] != d[k - key]:
                    return False
        return True

data = Solution()
arr = [1,2,3,4,5,10,6,7,8,9]
k = 5
print(data.canArrange(arr, k))